﻿@{
    ViewBag.Title = Model.Title_s;
    Layout = "~/Views/Shared/FrontEndMasterLayout.cshtml";
}
@model DLULearningNetworkModel.Course
@section cssjs{
    <link rel="Stylesheet" type="text/css" href="../../Content/Site.css" />
    <link rel="Stylesheet" type="text/css" href="../../Content/icon.css" />
    <link rel="Stylesheet" type="text/css" href="../../Content/base/jquery-ui-1.8.16.custom.css" />
    <script type="text/javascript" src="../../Scripts/jquery.raty.min.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery-ui-1.8.16.custom.min.js"></script>    
    <script type="text/javascript" src="../../Scripts/Custom/jsCourse.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#Tabs').tabs({
                cache: false,
                ajaxOptions: {
                    cache: false,
                    error: function (xhr, status, index, anchor) {
                        $(anchor.hash).html("Có lỗi xảy ra. Chúng tôi sẽ cố gắng khắc phục sớm ");
                    }
                }
            });

            $("#rating").raty({
                half: true,
                start: $("#rating").attr("rate"),
                size: 24,
                hintList: ['Bad', 'Poor', 'Regular', 'Good', 'Excellent'],
                starHalf: '../../Content/Images/star-half-big.png',
                starOff: '../../Content/Images/star-off-big.png',
                starOn: '../../Content/Images/star-on-big.png',
                width: 150,

                click: function (score, evt) {
                    var courseID = $(this).attr("courseID");
                    $.ajax({
                        url: "/Course/Vote",
                        type: "POST",
                        data: { "courseID": courseID, "rate": score },
                        cache: false,
                        dataType: "html",
                        success: function (data) {
                            alert(data);
                        }
                    });                    
                }
            });
        });
    </script>
}
@section rightColumn{
    <input type="hidden" id="courseID" value="@Model.CourseID_u" />
    <div style="width: 730px;">
        <div class="TieuDe">
            <div>
                <div style="float: left;">
                    @Model.Title_s
                </div>
                <div style="float: right; margin-top: -7px; font-size: 13px;">
                    @if (DLULearningNetwork.Controllers.FrontEndBaseController.LoginUser.AccountID_u == Model.AccountID_u)
                    {
                        if (!Model.IsRunningOnline_b)
                        {
                        <a href="/Course/ClassRoom/@Model.CourseID_u" target="_blank"><span class="podcast_icon32">
                            Khởi động lớp học trực tuyến</span></a>
                        }
                        else
                        {
                        <span class="podcast_icon32 deactive">Lớp học trực tuyến đang chạy</span>
                        }
                    }
                    else
                    {
                        if (Model.IsRunningOnline_b)
                        {
                        <a href="/Course/ClassRoom/@Model.CourseID_u" target="_blank"><span class="podcast_icon32">
                            Vào lớp học trực tuyến</span></a>                
                        }
                        else
                        {
                        <span class="podcast_icon32 deactive">Lớp học trực tuyến chưa được khởi động</span>                
                        }
                    }
                </div>
            </div>
            <div class="clearall">
            </div>
            <div id="rating" style="float: left;" rate="@Model.Rate_f" courseID="@Model.CourseID_u">
            </div>
            <div class="clearall">
            </div>
            <div class="description" style="margin-top: 5px;">
                @Model.Description_s
            </div>
        </div>
        <div id="Tabs" style="width: 100%;">
            <ul>
                <li><a href="/Course/Details/@Model.CourseID_u"><span>Tường</span></a></li>
                <li><a href="/Course/Schedule/@Model.CourseID_u"><span>Lịch học</span></a></li>
                <li><a href="/Course/Resources/@Model.CourseID_u"><span>Tài nguyên</span></a></li>
                <li><a href="/Course/Members/@Model.CourseID_u"><span>Thành viên</span></a></li>
                @if (DLULearningNetwork.Controllers.FrontEndBaseController.LoginUser.AccountID_u == Model.AccountID_u)
                {
                    <li><a href="/Course/Renew/@Model.CourseID_u"><span>Khai giảng khóa mới</span></a></li>            
                }
            </ul>
        </div>
        <div id="dialog" style="font-size: 14px;">
            <div id="dialog-loading" class="loading">
            </div>
        </div>
    </div>
}
